import $ from 'jquery';
import Button from './Button';

export default class BoldButton extends Button {
    constructor(opts) {
        super(opts);
        if (this.editor.util.os.mac) {
            this.title = `${this.title} ( Cmd + b )`;
        } else {
            this.title = `${this.title} ( Ctrl + b )`;
            this.shortcut = 'ctrl+b';
        }
    }
    _activeStatus() {
        let active;
        active = document.queryCommandState('bold') === true;
        this.setActive(active);
        return this.active;
    }
    command() {
        document.execCommand('bold');
        if (!this.editor.util.support.oninput) {
            this.editor.trigger('valuechanged');
        }
        return $(document).trigger('selectionchange');
    }
}
BoldButton.prototype.name = 'bold';
BoldButton.prototype.icon = 'bold';
BoldButton.prototype.htmlTag = 'b, strong';
BoldButton.prototype.disableTag = 'pre';
BoldButton.prototype.shortcut = 'cmd+b';
